var t = require("../../../../../../@babel/runtime/helpers/objectSpread2"), a = getApp();

Component({
    properties: {
        keywork: {
            type: null
        },
        memberId: {
            type: null
        }
    },
    data: {
        strUrl: "plugin.wechat-chat-sidebar.frontend.controller.customer.customer.favorite",
        getConfig: {
            client: "work",
            type: 17
        },
        collectionList: [],
        json: {
            page: 1
        },
        loading: !1,
        finished: !1
    },
    lifetimes: {
        attached: function() {
            var t = wx.getStorageSync("langIndex");
            this.setData({
                language: t.en
            }), this.getData();
        }
    },
    methods: {
        getData: function() {
            var e = this;
            if (!this.data.finished || !this.data.loading) {
                this.data.loading = !0;
                var s = {};
                "customer" == this.data.keywork && (this.data.strUrl = "plugin.customer-center.frontend.controllers.customer.favorite", 
                this.data.json.member_id = this.data.memberId, s = t({}, this.data.json));
                var o = a.getNetAddresss(this.data.strUrl);
                a._postNetWork({
                    url: o,
                    data: s,
                    success: function(t) {
                        var a = t.data;
                        1 == a.result && a.data.data ? ((e.data.json.page >= a.data.last_page || a.data.data.length < a.data.per_page) && e.setData({
                            finished: !0
                        }), e.setData({
                            collectionList: e.data.json.page > 1 ? e.data.collectionList.concat(a.data.data) : a.data.data,
                            "json.page": ++e.data.json.page
                        })) : (e.setData({
                            finished: !0
                        }), wx.showToast({
                            icon: "none",
                            title: a.msg,
                            duration: 1500
                        }));
                    },
                    fail: function(t) {
                        console.log(t);
                    }
                });
            }
        },
        loadMore: function() {
            this.getData();
        }
    }
});